<template>
  <div class="integralItem"> 
    <div class="userNameDiv">
      <div class="firstDiv">{{helpName}}</div>
      <div class="secondDiv">帮助用户</div>
    </div>
    <div class="integralTimeDiv">
      <div class="firstDiv">—美豆时间—</div>
      <div class="secondDiv">{{timeFormat}}</div>
    </div>
    <div class="integralNumberDiv">
      <div class="firstDiv" v-if="tabTyp == -1">{{helpIntegral}}</div>
      <div class="firstDiv" v-if="tabTyp == 8">-{{helpIntegral}}</div>
      <div class="firstDiv" v-if="tabTyp != 8 && tabTyp != -1">+{{helpIntegral}}</div>
      <div class="secondDiv">美豆数量</div>
    </div>
  </div>
</template>
<script>
  export default{
    props:{
      helpName:{
        type: String,
      },
      helpTime:{
        type: String,
      },
      helpIntegral:{
        type: Number,
      },
      tabTyp:{
        type: Number,
      }
    },
    computed:{
      timeFormat(){
        return this.formatDateTime(this.helpTime)
      }
    },
    methods:{
      formatDateTime (inputTime) {
        let date = new Date(inputTime);
        let y = date.getFullYear();
        let m = date.getMonth() + 1;
        m = m < 10 ? ('0' + m) : m;
        let d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        let h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        let minute = date.getMinutes();
        let second = date.getSeconds();
        minute = minute < 10 ? ('0' + minute) : minute;
        second = second < 10 ? ('0' + second) : second;
        return y + '-' + m + '-' + d + '　' + h + ':' + minute + ':' + second 
      },
    }
  } 
</script>
<style scoped>
.integralItem{
  display: flex;
  align-items: center;
  color: #a09f9f;
  font-size: 26rpx;
  background: #fff;
  border-bottom: 1px solid #efeff4;
  height: 137rpx;
}
.integralItem .userNameDiv{
  width: 30%;
  text-align: center;
}
.integralItem .userNameDiv .firstDiv{ 
  font-size: 30rpx;
  color: #000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 24rpx;
}
.integralItem .userNameDiv .secondDiv{
  margin-top: 10rpx;
}
.integralItem .integralTimeDiv{
  flex: 1;
  text-align: center;
}
.integralItem .integralTimeDiv .secondDiv{
  margin-top: 10rpx;
}
.integralItem .integralNumberDiv{
  text-align: center;
  width: 25%;
}
.integralItem .integralNumberDiv .firstDiv{ 
  font-size: 36rpx;
  color: #e38a8a;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  padding: 0 24rpx;
}
.integralItem .integralNumberDiv .secondDiv{
  margin-top: 10rpx;
}
</style>

